cmake_minimum_required(VERSION 3.10)

cmake_policy(SET CMP0074 NEW)
find_package(Boost COMPONENTS system)

include_directories(${Boost_INCLUDE_DIRS})

aux_source_directory(src SRC)

if(NOT (CMAKE_SYSTEM_NAME MATCHES "Windows") )
	aux_source_directory(unix_src UNIX_SRC)
endif()

add_library(protocol SHARED ${SRC} ${UNIX_SRC}) 

target_link_libraries(protocol osmsg oslog misc tinyxml ${Boost_LIBRARIES})

set_target_properties(protocol PROPERTIES WIN32_MANIFEST "NO")

install(TARGETS protocol LIBRARY)

find_package(CxxTest)
if(CXXTEST_FOUND)
    include_directories(${CXXTEST_INCLUDE_DIR})
    enable_testing()
    CXXTEST_ADD_TEST(test_protocol test_protocol.cpp 
		${CMAKE_CURRENT_SOURCE_DIR}/test/fcs.hxx
		)
	target_link_libraries(test_protocol protocol)
	set_target_properties(test_protocol PROPERTIES WIN32_MANIFEST "NO")
endif()